import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '平台类型',
    align: "center",
    dataIndex: 'type_dictText'
  },
  {
    title: '名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: 'APP地址',
    align: "center",
    dataIndex: 'appAddress'
  },
  {
    title: '网页地址',
    align: "center",
    dataIndex: 'webAddress'
  },
  {
    title: '账号',
    align: "center",
    dataIndex: 'account'
  },
  {
    title: '密码',
    align: "center",
    dataIndex: 'password'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'start_dictText'
  },
  {
    title: '用户',
    align: "center",
    dataIndex: 'userId_dictText'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "平台类型",
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "submit_platform_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "名称",
    field: 'name',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "账号",
    field: 'account',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'start',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "feedback_status"
    },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '平台类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "submit_platform_type",
      type: "radio"
    },
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: 'APP地址',
    field: 'appAddress',
    component: 'Input',
  },
  {
    label: '网页地址',
    field: 'webAddress',
    component: 'Input',
  },
  {
    label: '账号',
    field: 'account',
    component: 'Input',
  },
  {
    label: '密码',
    field: 'password',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'start',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "feedback_status",
      type: "radio"
    },
  },
  {
    label: '用户',
    field: 'userId',
    component: 'JSearchSelect',
    componentProps: {
      dict: "cu_user_details,user_name,id"
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  type: { title: '平台类型', order: 0, view: 'radio', type: 'string', dictCode: 'submit_platform_type', },
  name: { title: '名称', order: 1, view: 'text', type: 'string', },
  appAddress: { title: 'APP地址', order: 2, view: 'text', type: 'string', },
  webAddress: { title: '网页地址', order: 3, view: 'text', type: 'string', },
  account: { title: '账号', order: 4, view: 'text', type: 'string', },
  password: { title: '密码', order: 5, view: 'text', type: 'string', },
  start: { title: '状态', order: 6, view: 'radio', type: 'string', dictCode: 'feedback_status', },
  userId: { title: '用户', order: 7, view: 'sel_search', type: 'string', dictTable: "cu_user_details", dictCode: 'id', dictText: 'user_name', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}